<template>
    <div class="comp-profile" v-if="isLoading === false">
        <span class="profile-box" v-if="hasLogin === false">
            <!--<a href="./register.html" class="link">Sign Up</a>-->
            <a href="./login.html" class="link">Sign In</a>
        </span>
        <a class="link" @click="logout()">Logout</a>
    </div>
</template>

<script type="text/babel">
    import commonService from '../common/commonService';
    import lib from '../common/lib';

    export default {
        data() {
            return {
                isLoading: true,
                hasLogin: false,
                user: {}
            };
        },
        props: {
            iconName: {
                type: String
            }
        },
        created(){
            this.isLoading = true;
            // 个人信息
            commonService.basic().done((rep) => {
                if (rep.code === window.CODE.SUCCESS) {
                    this.hasLogin = true;
                    this.user = rep.data;
                }
            }).always(rep => {
                this.isLoading = false;
            });
        },
        methods: {

        }
    }
</script>

<style lang="sass" rel="stylesheet/scss">
    .comp-profile {

    }
</style>